/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <cstdio>

using namespace std;
const int N=10;
int seq[N]={0};
int main_77()
{
    int n;
    bool isIncremental=true;
    scanf("%d",&n);
    for (int i=0;i<n ;++i )
    {
        scanf("%d",&seq[i]);
    }
    for (int i=0;i<(n-1) ;++i )
    {
        if (seq[i]>seq[i+1])
        {
            isIncremental=false;
            break;
        }
    }
    if (isIncremental)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
	return 0;
}
